﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace TMIS
{
    public partial class frmIdentify : frmCommon
    {
        private Guid guid;
        private BLL.Identify bll = new BLL.Identify();
        public frmIdentify()
        {
            InitializeComponent();
        }
        public frmIdentify(Guid guid)
        {
            this.InitializeComponent();
            this.guid = guid;
            this.FillComponent();
        }
        /// <summary>
        /// 窗体控件数据初始化
        /// </summary>
        private void FillComponent()
        {
            Model.Identify ide=bll.Get(guid);
            comfirstTeacher.Text = bll.GetFirseTeacher(guid);
            comSecondTeacher.Properties.Items.AddRange(bll.GetTeacher());
            txtLocation.Text = ide.Location;
            txtDate.Text = Convert.ToDateTime(ide.Date).ToShortDateString();
            txtOpinion.Text = ide.Opinion;
            this.Priview();
        }
        private void frmIdentify_Load(object sender, EventArgs e)
        {

        }
        public override void Save()
        {
            Model.Identify ide=new Model.Identify ()
            {
                ID = this.guid,
                TeacherID=bll.GetID(comSecondTeacher.Text),
                Location=txtLocation.Text,
                Date=Convert.ToDateTime(txtDate.Text),
                Opinion=txtOpinion.Text,
            };
            bll.Update(ide);

        }

        public override void Priview()
        {
            this.identifyTableAdapter.FillByStudentID(this.reportDS.Identify, this.guid);
            this.reportViewer.RefreshReport();
        }
    }
}
